Add precommit and run precommit on all files#26
Add precommit and run precommit on all files#26tomelm wants to merge 1 commit intographql-python:masterfrom tomelm:add-precommit
Conversation
2 similar comments
chriskuehl
left a comment
There was a problem hiding this comment.
lgtm. often we add pre-commit run --all-files to the tests somewhere which helps to make sure it doesn't regress, but it's up to you if you want to do that or not.
| @@ -0,0 +1 @@ | |||
| pre-commit==0.13.3 | |||
There was a problem hiding this comment.
I'd probably call this file requirements-dev.txt since you don't actually need pre-commit to be installed in production (and that's what requirements.txt implies, even if you're not actually doing it in this case).
There was a problem hiding this comment.
Also, we usually don't pin specific versions for our dev dependencies, but that's totally up to you / the project's stance on that.
There was a problem hiding this comment.
Maybe adding something like the following in the README will actually add more visibility into Yelp's pre-commit project and provide a better understanding to the developer, rather than using a requirements.txt file that might confuse collaborators :)
Collaborate
This project is using pre-commit to help the developer run pre-commit hooks easily, allowing to autoformat Python files, reorder the imports, and other various checks.
You can easily start using it via pip install pre-commit.
Thoughts?
| - repo: https://github.com/asottile/reorder_python_imports | ||
| sha: v0.3.2 | ||
| hooks: | ||
| - id: reorder-python-imports |
There was a problem hiding this comment.
I've been using isort for checking the import ordering: https://github.com/graphql-python/flask-graphql/blob/master/tox.ini#L30.
Also being used in the automatic linters in graphql-core https://github.com/graphql-python/graphql-core/blob/master/bin/autolinter#L7, and graphene https://github.com/graphql-python/graphene/blob/master/bin/autolinter#L7.
I kind of prefer it over render-python-imports as it seems it does a smarter import grouping, not requiring a import statement per imported var.
If we could use isort instead of render-python-imports would be great! :)
|
Other than the comments, everything is looking great... thanks for the work @tomelm! :) |
Adds pre-commit and runs it on all the current files. I skipped a few validations so I'm not making too many big changes and also set the max-line-length to 120: